﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Home.Master" AutoEventWireup="true" CodeBehind="ListStaff.aspx.cs" Inherits="TimeWork.ListStaff" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Breadcrumb" ContentPlaceHolderID="Bredcrumb" runat="server">
    <li><a href="#" class="report">Quản trị</a></li>>
    <li><a href="#">Quản lý người dùng</a></li>
</asp:Content>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
    <form runat="server"> 
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>   
    <h2>Danh sách người dùng</h2>
    <div class="list-staff">
        <asp:UpdatePanel ID="UpdatePanel" runat="server">
            <ContentTemplate>
                <asp:GridView ID="GVListStaff" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="StaffEmail, StaffResultUnitID, StaffPermissionID" 
                    onrowdatabound="GVListStaff_RowDataBound" 
                    onrowcancelingedit="GVListStaff_RowCancelingEdit" 
                    onrowediting="GVListStaff_RowEditing" 
                    onrowupdating="GVListStaff_RowUpdating" 
                    onrowdeleting="GVListStaff_RowDeleting" 
                    onrowcommand="GVListStaff_RowCommand">
                    <Columns>
                        <asp:TemplateField HeaderText="STT" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%# Container.DataItemIndex + 1 %>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Email" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                            <ItemTemplate>
                                <asp:HyperLink ID="hplStaffEmail" runat="server" Text='<%# Eval("StaffEmail") %>'></asp:HyperLink>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Họ tên" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtStaffName" runat="server" Text='<%# Bind("StaffName") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblStaffName" Text='<%# Eval("StaffName") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Phòng ban" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                            <EditItemTemplate>
                                <asp:DropDownList ID="ddlResultUnitName" runat="server" DataTextField="ResultUnitName" DataValueField="ResultUnitID"></asp:DropDownList>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label runat="server" ID="txtResultUnitName" Text='<%# Eval("ResultUnitName") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Chức vụ" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                            <EditItemTemplate>
                                <asp:TextBox ID="txtStaffPosition" runat="server" Text='<%# Bind("StaffPosition") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblStaffPosition" Text='<%# Eval("StaffPosition") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Quyền hạn" HeaderStyle-HorizontalAlign="Center" HeaderStyle-BackColor="#f3f9ff" HeaderStyle-ForeColor="#375b91">
                            <EditItemTemplate>
                                <asp:DropDownList ID="ddlPermissionName" runat="server" DataTextField="PermissionName" DataValueField="PermissionID"></asp:DropDownList>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblPermissionName" Text='<%# Eval("PermissionName") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BackColor="#F3F9FF" ForeColor="#375B91" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField ShowHeader="False" HeaderStyle-HorizontalAlign="Center">
                            <EditItemTemplate>
                                <asp:ImageButton ID="imgUpdate" runat="server" CommandName="Update" ImageUrl="~/resources/img/icons/update.png"  ToolTip="Cập nhật" CssClass="wrap_input"></asp:ImageButton>
                                <asp:ImageButton ID="imgCancel" runat="server" CommandName="Cancel" ImageUrl="~/resources/img/icons/cancel.png"  ToolTip="Hủy" CssClass="wrap_input"></asp:ImageButton>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:ImageButton ID="imgEdit" runat="server" CommandName="Edit" ImageUrl="~/resources/img/icons/page_white_edit.png" ToolTip="Sửa" CssClass="wrap_input"></asp:ImageButton>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgDelete" runat="server" CommandName="Delete" ImageUrl="~/resources/img/icons/delete.png"  ToolTip="Xóa" CssClass="wrap_input" OnClientClick="return confirm('Bạn chắc chắn muốn xóa người dùng này?');"></asp:ImageButton>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgReset" runat="server" ImageUrl="~/resources/img/icons/reset.png" CssClass="input-image" CommandName="ResetPass" CommandArgument='<%# Eval("StaffEmail") %>' ToolTip="Reset mật khẩu" OnClientClick="return confirm('Bạn chắc chắn muốn reset mật khẩu người dùng này?');"/>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <div class="insert-item">
        <asp:Button ID="btnAdd" runat="server" Text="Thêm mới" CssClass="mybutton" onclick="btnAdd_Click" />&nbsp;
        <asp:Button ID="btnImport" runat="server" Text="Nhập từ tệp" CssClass="mybutton color-yellow" onclick="btnImport_Click" />
    </div>
    <div class="clear"></div> 
</form>
</asp:Content>
